package com.github.bobjoy.java.spi;

import com.github.bobjoy.java.spi.plugin.PluginManager;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * 学习地址：http://blog.csdn.net/huxu981598436/article/details/78557566
 */
public class PluginDemo {

    public static void main(String[] args) throws Exception {

        PluginManager manager = new PluginManager("E:\\workspaces\\study\\java-learning\\spi\\plugin.txt");

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String cmd = br.readLine();

        while(!cmd.equals("bye")){
            if(cmd.startsWith("do")){
                manager.executePlugin();
            }
            if(cmd.startsWith("load")){
                manager.loadPlugins();
            }
            if(cmd.startsWith("unload")){
                manager.unloadPlugins();
            }
            cmd = br.readLine();
        }

    }
}
